/**
 * Created with IntelliJ IDEA
 * Description:
 * User: Administrator
 * Data: 2023 - 07 - 05
 * Time: 11:02
 */
class Solution3 {
    public int removeDuplicates(int[] nums) {
        int slow = 0;
        int fast = 1;
        while(fast < nums.length) {
            if(nums[fast] == nums[slow]) {
                fast++;
            }else {
                nums[slow + 1] = nums[fast];
                slow++;
            }
        }
        return slow + 1;
    }
}


